package com.itheima.boject;

import java.util.Scanner;

public class StringBigSmallDemo {
    public static void main(String[] args) {
        //键盘录入
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入:");
        String s = sc.next();

        //定义计数器,定义三种字符类型需要三个统计变量
        int bigCount = 0;
        int smallCount = 0;
        int numCount = 0;

        //遍历字符串,得到每一个字节
        //char[] toCharArray( )获取字符串对应的字符数组
        char[] chars = s.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            char c = chars[i];
            if (c >= 'A' && c <= 'Z') {
                bigCount++;
            }else if(c >= 'a' && c <= 'z'){
                smallCount++;
            }else if(c >= '0' && c <= '9'){
                numCount++;
            }
        }
        //输出打印结果
        System.out.println("大写字母字符:"+bigCount);
        System.out.println("小写字母字符:"+smallCount);
        System.out.println("数字字母字符:"+numCount);
    }
}